﻿using System;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.pp.mediator;
using SharpSqlAnalyzer.pp.mediator.type;
using SharpSqlAnalyzer.pp.utils;

namespace SharpSqlAnalyzer.pp.processor.type.comm
{
	// Token: 0x0200024D RID: 589
	public class AppendNewLineAfterReverseKeyWordProcessor : AbstractProcessor
	{
		// Token: 0x0600131F RID: 4895 RVA: 0x0031CC90 File Offset: 0x0031AE90
		public override void process(TParseTreeNode node)
		{
			if (node == null)
			{
				return;
			}
			bool parameter = this.getParameter<bool>(typeof(bool));
			string parameter2 = this.getParameter<string>(typeof(string), 1);
			TSourceToken startToken = node.startToken;
			TSourceToken tsourceToken = SourceTokenSearcher.backforwardSearch(startToken, 10, parameter2);
			if (tsourceToken != null)
			{
				int num = SourceTokenOperator.curColumnNumberVT(tsourceToken);
				MediatorFactory.getMediator<KeywordAlignMediator>(typeof(KeywordAlignMediator), this.Option.sessionId).addIndentLevelItem(tsourceToken, num);
				SourceTokenOperator.removeWhitespaceAndReturnFromEnd(this.Option, startToken);
				if (parameter)
				{
					SourceTokenOperator.addBefore(this.Option, startToken, SourceTokenOperator.createReturnSourceToken());
					SourceTokenOperator.addBefore(this.Option, startToken, SourceTokenOperator.createWhitespaceSourceToken(num + this.Option.indentLen));
					return;
				}
				SourceTokenOperator.addBefore(this.Option, startToken, SourceTokenConstant.WHITESPACE);
			}
		}
	}
}
